import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';
import 'package:flutter_ahj_app/base/utils/ToastUtils.dart';
import 'package:flutter_ahj_app/base/utils/permission/PerUtils.dart';
import 'package:flutter_ahj_app/base/utils/permission/permissionGroup.dart';
import 'package:permission_handler/permission_handler.dart';

const MethodChannel _kChannel = MethodChannel('com.ahj/mPaasPlugin');

class MPaasUtils {
  /**
   * 跳转小程序
   * sid 用户sid
   * url 小程序地址
   * userId
   */
  static jumpTomPaasProgram(BuildContext context, Map map) async {
    // List<Permission> list = [Permission.photos, Permission.storage];
    // if (map['url'] == "2021101320000001") {
    //   // 跳转应急预案小程序需要定位权限
    //   list.add(PermissionGroup.location);
    // }
    // String resultStr = await PerUtils.checkPermission(context, list);

    // if (resultStr == '0') {
    //   ToastUtils.showToast("请先开启权限");
    //   return;
    // } else if (resultStr == '1') {
    //   // return await _kChannel.invokeMethod('jumpTomPaas', map);
    //
    //   var result = await Modular.to.pushNamed<String>(map['page']);
    //   if (result == "refresh") {
    //     return "EXITMPAAS";
    //   }
    // }
  }
}
